#ifndef __GWREFERENCE_HPP__
#define __GWREFERENCE_HPP__

#include "gwcommon.h"


/**
*@file       gwreference.hpp
*@brief      contains a reference to an object type, use to function templates take parameter by value.
*
*@author     graywind
*@version    1.0.0.0
*@data       2011/12/27
*/

///util stuff
namespace gwBedrockUtil
{
        ///reference type work with gwBind class
        template<class T>
        class gwReference;
}

///util stuff
namespace gwBedrockUtil
{
        ///reference type work with gwBind class
        template<class T>
        class gwReference
        {
        public:
                typedef  T    gwDataType;

                explicit gwReference(T& _t) : t(&_t){}

                operator T& () const { return *t; }

        public:
                T&   operator=(const T& rhs) const { *t = rhs; return *t; }

        private:
                T*    t;
        };
}

#endif
